package com.aids_malaria.db.dao;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import com.aids_malaria.http.response.MosquitoInvest;

import java.util.List;

@Dao
public interface MosquitoInvestDao {
    @Query("delete from mosquitoInvest")
    int deleteAll();

    @Query("SELECT * FROM mosquitoInvest")
    List<MosquitoInvest> getAll();

    @Query("SELECT * FROM mosquitoInvest WHERE createOrUpdate =:isCreateUpdate")
    List<MosquitoInvest> getAllByCreateUpdate(boolean isCreateUpdate);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    List<Long> insertAll(List<MosquitoInvest> users);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    Long insert(MosquitoInvest users);

    @Update
    int update(MosquitoInvest users);

    @Query("SELECT * FROM mosquitoInvest where invest_area_code = :invest_area_code and record_seq = :record_seq")
    List<MosquitoInvest> findByAreaCode(String invest_area_code, int record_seq);


    @Query("SELECT * FROM mosquitoInvest where invest_area_code = :invest_area_code")
    List<MosquitoInvest> findByCode(String invest_area_code);

}

